#ifndef __OBJECT_H
#define __OBJECT_H

/*
	OBJECT.H

	The CObject class

	OpenGL Game Programming
	Author: Kevin Hawkins
	Date: 3/29/2001
	Description: The CObject class is derived from CNode and
				 represents an object in the game world.

*/

#include "tree.h"
#include "vector.h"

class CCamera;

class CObject : public CNode
{
protected:
	virtual void OnDraw(CCamera *camera) {}
	virtual void OnCollision(CObject *collisionObject) {}
	virtual void OnAnimate(scalar_t deltaTime);
	virtual void OnPrepare();

public:
	CVector position;		// object position
	CVector velocity;		// velocity of object
	CVector acceleration;	// acceleration
	scalar_t size;			// size of bounding sphere (radius)

	bool isDead;

	CObject();
	~CObject();

	virtual void Load() {}
	virtual void Unload() {}

	void Draw(CCamera *camera);
	void Animate(scalar_t deltaTime);
	void ProcessCollisions(CObject *obj);
	void Prepare();
	CObject* FindRoot();

	double DistanceToObject(CObject* obj);
};

#endif